class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        vector<int> vv(1002, 0);
        vector<int> ret;
        for (int i = 0; i < nums1.size(); i++)
        {
            vv[nums1[i]] = 1;
        }
        for (int j = 0; j < nums2.size(); j++)
        {
            if (--vv[nums2[j]] == 0)
                ret.push_back(nums2[j]);

        }
        return ret;
    }
};